<!-- 
  * @Description:产品服务的搜索框 
  * @Author:lxy 
  * @Date:2023-03-24 10:23  
-->
<template>
  <div class="bioati">
    <el-form
      ref="searchFromRef"
      :model="searchFromData"
      :inline="true"
      class="demo-ruleForm"
    >
      <el-row type="flex" justify="space-between">
        <el-form-item label="探视人姓名：">
          <el-input
            placeholder="请输入"
            v-model="searchFromData.username"
          ></el-input>
        </el-form-item>

        <el-form-item label="老人姓名：">
          <el-input
            placeholder="请输入"
            v-model="searchFromData.oldname"
          ></el-input>
        </el-form-item>

        <el-form-item label="探视人性别：" style="margin-left: 15px">
          <el-radio v-model="searchFromData.sex" label="all">全部</el-radio>
          <el-radio v-model="searchFromData.sex" label="男">男</el-radio>
          <el-radio v-model="searchFromData.sex" label="女">女</el-radio>
        </el-form-item>


        <el-form-item label="预约审核：" style="margin-left: 15px">
          <el-select v-model="searchFromData.shenhe" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item>
          <div style="text-align: right">
            <el-button icon="el-icon-refresh" @click="resetForm"
              >重置</el-button
            >
            <el-button type="primary" icon="el-icon-search" @click="submitFrom"
              >查询</el-button
            >
          </div>
        </el-form-item>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "searchFrom",
  data() {
    return {
      searchFromData: {
        oldname: "",
        username: "",
        sex: "all",
        shenhe: "all",
      },
      options: [{
          value: 'all',
          label: '全部'
        }, {
          value: true,
          label: '通过'
        }, {
          value: false,
          label: '未通过'
        }],
    };
  },
  methods: {
    submitFrom() {
      this.$emit("forSubmit", this.searchFromData); //    传递数据
    },
    getSearchForm() {
      //方便外面主动来获取数据
      return this.searchFromData;
    },
    resetForm() {
      //重置操作
      this.searchFromData.oldname = "";
      this.searchFromData.username = "";
      this.searchFromData.sex = "all";
      this.searchFromData.shenhe = "all";
      //接着发送数据 进行网络请求
      this.$emit("forSubmit", this.searchFromData); // 传递数据
    },
  },
};
</script>

<style scoped lang="less">
.bioati {
  margin: 15px 0px;
  align-items: center;
  height: 40px;
}
.demo-ruleForm > .el-row {
  :deep(.el-form-item) {
    width: 360px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .el-form-item__label {
      white-space: nowrap !important;
    }
    .el-form-item__content {
      flex: 1;
    }
  }
}
</style>
